var express = require('express');
var config = require('./config');
var mongoose = require('mongoose');
//var logger = require('log4js').getLogger();
var router = require('./router');
var domain = require('domain');
var app = express();
var d = domain.create();
d.on('error', function(er) {
    console.error('Caught error!', er);
});
d.run(function(){
    appStart();
});
function appStart(){
    app.set('views', __dirname + '/views');
    app.set('view engine','jade');
    app.engine('jade', require('jade').__express);
    app.use(express.static(__dirname + '/public'));
    router(app);
    app.listen(10000);
    console.log("Express server listening on port 10000");
    //throw new Error()
}
//appStart();
